package com.bosssoft.setp.handler;


import org.springframework.stereotype.Service;
import xyz.erupt.annotation.fun.DataProxy;
import xyz.erupt.core.exception.EruptApiErrorTip;
import com.bosssoft.setp.model.system.System;
@Service
public class SystemDataProxy implements DataProxy<System> {
    @Override
    public void beforeAdd(System system) {
        if(system.getNote() != null && !system.getNote().isEmpty()) {
            Double note = Double.parseDouble(system.getNote());
            if (note < 0) {
                throw new EruptApiErrorTip("不能小于0");
            }
        }
    }
    @Override
    public void beforeUpdate (System system)
    {
        if(system.getNote() != null && !system.getNote().isEmpty()) {
            Double note = Double.parseDouble(system.getNote());
            if (note < 0) {
                throw new EruptApiErrorTip("不能小于0");
            }
        }
    }
}
